package day19;

public class Singleton1 {
	// 懒汉式单例模式
		// 以时间换空间（啥时候用，啥时候new）
		private static Singleton1 instance = null;
		private Singleton1() {
			
		}
		public static synchronized Singleton1 getInstance() {
			if(instance == null) {
				instance = new Singleton1();
			}
			return instance;
		}
}
